package com.boyuan.huijiaoyu;

import android.os.Bundle;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class AboutHuijiaoyuActivity extends Activity implements OnClickListener{

	private TextView tv_banben;
	private String version;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_about_huijiaoyu);
		version = getversion();
		initUI();
	}

	private void initUI() {
		tv_banben = (TextView) findViewById(R.id.tv_banben);
		tv_banben.setText("会教育 "+version);
		RelativeLayout lay_back = (RelativeLayout) findViewById(R.id.lay_back_guanyu);
		lay_back.setOnClickListener(this);
	}
	
	public String getversion(){
		String str = "";
		try {
			PackageManager packageManager = this.getPackageManager();
			PackageInfo info = packageManager.getPackageInfo(this.getPackageName(), 0);
			String version = info.versionName;
			str = version;
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
		
		return str;
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.about_huijiaoyu, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.lay_back_guanyu:
			finish();
			break;

		default:
			break;
		}
	}


}
